package com.ruoyi.net.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.uuid.IdUtils;
import com.ruoyi.net.domain.BusiL2VpnNode;
import com.ruoyi.net.domain.BusiL2VpnNodeListVo;
import com.ruoyi.net.mapper.BusiL2VpnNodeMapper;
import com.ruoyi.net.service.IBusiL2VpnNodeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 业务-L2 VPN配置-节点列表Service业务层处理
 * 
 * @author net
 * @date 2024-12-14
 */
@Service
public class BusiL2VpnNodeServiceImpl implements IBusiL2VpnNodeService 
{
    @Autowired
    private BusiL2VpnNodeMapper busiL2VpnNodeMapper;

    /**
     * 查询业务-L2 VPN配置-节点列表
     * 
     * @param id 业务-L2 VPN配置-节点列表主键
     * @return 业务-L2 VPN配置-节点列表
     */
    @Override
    public BusiL2VpnNode selectBusiL2VpnNodeById(String id)
    {
        return busiL2VpnNodeMapper.selectBusiL2VpnNodeById(id);
    }

    /**
     * 查询业务-L2 VPN配置-节点列表列表
     * 
     * @param busiL2VpnNode 业务-L2 VPN配置-节点列表
     * @return 业务-L2 VPN配置-节点列表
     */
    @Override
    public List<BusiL2VpnNodeListVo> selectBusiL2VpnNodeList(BusiL2VpnNode busiL2VpnNode)
    {
        return busiL2VpnNodeMapper.selectBusiL2VpnNodeList(busiL2VpnNode);
    }

    /**
     * 新增业务-L2 VPN配置-节点列表
     * 
     * @param busiL2VpnNode 业务-L2 VPN配置-节点列表
     * @return 结果
     */
    @Override
    public int insertBusiL2VpnNode(BusiL2VpnNode busiL2VpnNode)
    {
        String uuid = IdUtils.simpleUUID();
        if (StringUtils.isEmpty(busiL2VpnNode.getId())) {
            busiL2VpnNode.setId(uuid);
        }
        busiL2VpnNode.setCreateBy(SecurityUtils.getUsername());
        busiL2VpnNode.setCreateTime(DateUtils.getNowDate());
        busiL2VpnNode.setUpdateBy(SecurityUtils.getUsername());
        busiL2VpnNode.setUpdateTime(DateUtils.getNowDate());
        return busiL2VpnNodeMapper.insertBusiL2VpnNode(busiL2VpnNode);
    }

    /**
     * 修改业务-L2 VPN配置-节点列表
     * 
     * @param busiL2VpnNode 业务-L2 VPN配置-节点列表
     * @return 结果
     */
    @Override
    public int updateBusiL2VpnNode(BusiL2VpnNode busiL2VpnNode)
    {
        busiL2VpnNode.setUpdateBy(SecurityUtils.getUsername());
        busiL2VpnNode.setUpdateTime(DateUtils.getNowDate());
        return busiL2VpnNodeMapper.updateBusiL2VpnNode(busiL2VpnNode);
    }

    /**
     * 批量删除业务-L2 VPN配置-节点列表
     * 
     * @param ids 需要删除的业务-L2 VPN配置-节点列表主键
     * @return 结果
     */
    @Override
    public int deleteBusiL2VpnNodeByIds(String[] ids)
    {
        return busiL2VpnNodeMapper.deleteBusiL2VpnNodeByIds(ids);
    }

    /**
     * 删除业务-L2 VPN配置-节点列表信息
     * 
     * @param id 业务-L2 VPN配置-节点列表主键
     * @return 结果
     */
    @Override
    public int deleteBusiL2VpnNodeById(String id)
    {
        return busiL2VpnNodeMapper.deleteBusiL2VpnNodeById(id);
    }
}
